package com.xunji.user.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.xunji.user.util.UUIDUtil;
import com.xunji.user.vo.req.RoleUpdateRequest;
import lombok.Data;

import java.time.LocalDateTime;

@TableName(value = "t_lp_role")
@Data
public class Role {

    private String id;

    private String name;

    private String createdBy;

    private LocalDateTime createdTime;

    public static Role getInstance(String name) {
        Role role = new Role();
        role.setId(UUIDUtil.getUUID());
        role.setName(name);
        role.setCreatedTime(LocalDateTime.now());
        return role;
    }

    public static Role getInstance(RoleUpdateRequest request) {
        Role role = new Role();
        role.setId(request.getId());
        role.setName(request.getName());
        role.setCreatedTime(LocalDateTime.now());
        return role;
    }

}
